home *** CD-ROM | disk | FTP | other *** search
/ ASME's Mechanical Engine…ing Toolkit 1997 December / ASME's Mechanical Engineering Toolkit 1997 December.iso / ai / prlg195b.lzh / CHART.LZH / TEST01.PRO < prev    next >
Text File  |  1987-03-31  |  1KB  |  52 lines

  1. /*
  2.   File:         test01.pro
  3.   Author:       Peter Ross
  4.   Updated:      3 June 1985
  5.  
  6.  This file contains a sample grammar for use with the chart parser
  7.  in the file chart.pro. This example is very crude indeed. A slightly
  8.  more interesting example (the same grammar, but using compound terms
  9.  as categories) can be found in test02.pro.
  10.  
  11.  ============ SAMPLE GRAMMAR ============
  12. */
  13.  
  14. initial_category(trial,s).
  15. strategy(trial,S) :-
  16.         prompt(_,'Strategy (td/bu): '),
  17.         read(S),
  18.         member(S,[td,bu]),
  19.         !.
  20. strategy(trial,S) :-
  21.         write('Answer  td.  or  bu.  please'), nl,
  22.         strategy(trial,S).
  23. policy(trial,P) :-
  24.         prompt(_,'Policy (bf/df):   '),
  25.         read(P),
  26.         member(P,[bf,df]),
  27.         !.
  28. policy(trial,P) :-
  29.         write('Answer  df.  or  bf.  please'), nl,
  30.         policy(trial,P).
  31.  
  32. rule(trial, s,  [np, vp]).
  33. rule(trial, np, [det, n]).
  34. rule(trial, np, [np, pp]).
  35. rule(trial, vp, [v]).
  36. rule(trial, vp, [v, np]).
  37. rule(trial, vp, [v, np, pp]).
  38. rule(trial, pp, [p, np]).
  39.  
  40. lexical(trial, the,       [det]).
  41. lexical(trial, a,         [det]).
  42. lexical(trial, man,       [n,v]).
  43. lexical(trial, women,     [n]).
  44. lexical(trial, park,      [n]).
  45. lexical(trial, telescope, [n]).
  46. lexical(trial, in,        [p]).
  47. lexical(trial, with,      [p]).
  48. lexical(trial, saw,       [n,v]).
  49. lexical(trial, likes,     [v]).
  50.  
  51.  
  52.